<?php
namespace NanQi\Hope;


use App\Services\UploadService;
use Illuminate\Redis\Connections\PhpRedisConnection;
use Illuminate\Support\Facades\Redis;
use SimpleSoftwareIO\QrCode\BaconQrCodeGenerator;

class Hope
{
    public static function isProduct(): bool
    {
        $env = env('APP_ENV', 'local');
        if ($env === 'prod') {
            return true;
        }
        return false;
    }

    public static function getRedis(string $connection = 'default'): PhpRedisConnection
    {
        /** @var PhpRedisConnection $redis */
        $redis = Redis::connection($connection);
        return $redis;
    }

    public static function getLoginId(): int
    {
        $jwt = app(Jwt::class);
        $user_id = $jwt->checkToken();
        if ($user_id === false) {
            return 0;
        }

        return $user_id;
    }
}
